home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 2000
/
MacHack 2000.toast
/
pc
/
The Hacks
/
Softshoe
/
Lisa's Mac Parts
/
Action
/
Action.cp
next >
Wrap
Text File
|
2000-06-23
|
764b
|
47 lines
// Action.cp
#ifndef Action_h
#include "Action.h"
#endif
#ifndef Assert_h
#include "Assert.h"
#endif
bool Action::CanUndo() const
{
return true;
}
bool Action::CanRedo() const
{
return true;
}
void Action::Commit( bool )
{
}
Action& Action::Nothing()
{
class NoAction: public Action
{
virtual void Undo() {}
virtual void Redo() {}
};
static NoAction nothing;
return nothing;
}
Action& Action::Irreversible()
{
class IrreversibleAction: public Action
{
virtual bool CanUndo() const { return false; }
virtual bool CanRedo() const { return false; }
virtual void Undo() { Assert( false ); }
virtual void Redo() { Assert( false ); }
};
static IrreversibleAction irreversible;
return irreversible;
}